
package ui.adapter;

import android.content.Context;

import net.ck.hzq.R;

import java.util.ArrayList;
import java.util.List;

import Bean.MessagecenterBean;
import Utils.StringUtil;
import base.BaseViewHolder;
import base.SuperBaseAdapter;


/**
 * 消息适配器
 * Created by chenjian on 19/2/27.
 */
public class MessageAdapter extends SuperBaseAdapter<MessagecenterBean.DataBean.ItemsBean> {

    List<MessagecenterBean.DataBean.ItemsBean> mData = new ArrayList<>();
    Context mContext;

    public MessageAdapter(Context context, List<MessagecenterBean.DataBean.ItemsBean> data) {
        super(context, data);
        mContext = context;
        mData = data;
    }

    @Override
    protected void convert(BaseViewHolder holder, final MessagecenterBean.DataBean.ItemsBean item, final int position) {
        holder.setText(R.id.fragment1_mc_txt1, item.getTitle()).setText(R.id.fragment1_mc_txt2, StringUtil.getFormatDate(item.getGmtCreate()))
                .setText(R.id.fragment1_mc_txt3, item.getContent());
        holder.setVisible(R.id.fragment1_mc_txt4, item.getIsRead() == 0);
    }


    @Override
    protected int getItemViewLayoutId(int position, MessagecenterBean.DataBean.ItemsBean item) {
        return R.layout.listviewmessagecenter_item;
    }

}
